package com.sdwl.brcl.validation.validation;

import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xied
 * @date 2021年06月11日 14:17
 */
public class ValidationResult {
    private boolean isSuccess;
    private List<ValidationError> errors;
    private List<String> msgList;
    private List<Object> errorStringCodeList;

    public ValidationResult() {
    }

    public List<String> getMsgList() {
        return msgList;
    }

    public List<Object> getErrorStringCodeList() {
        return errorStringCodeList;
    }

    public ValidationResult(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }

    public boolean isSuccess() {
        return this.isSuccess;
    }

    public void setIsSuccess(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }

    public void addError(ValidationError error) {
        if (this.errors == null) {
            this.errors = new ArrayList();
        }

        this.errors.add(error);
    }

    public void addMsg(String msg) {
        if (this.msgList == null) {
            this.msgList = Lists.newArrayList();
        }

        this.msgList.add(msg);
    }

    public void addErrorStringCode(Object errorStringCode) {
        if (this.errorStringCodeList == null) {
            this.errorStringCodeList = Lists.newArrayList();
        }

        this.errorStringCodeList.add(errorStringCode);
    }

    public List<ValidationError> getErrors() {
        return this.errors;
    }
}
